package com.polytech.ihm;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;

import com.polytech.beans.Brand;
import com.polytech.ihm.factory.ButtonsPanel;
import com.polytech.ihm.factory.Form;

public class NewBrandFrame extends JDialog {

	private JPanel mainPanel=new JPanel(new BorderLayout());
	private Brand brand=new Brand();
	private Form  form=new Form(brand);
	private ButtonsPanel buttonsPanel=new ButtonsPanel(new String[]{"Annuler","Valider"});
	public NewBrandFrame(JFrame owner) {
		super(owner,"Nouvelle Marque",true);
	 	setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		setContentPane(mainPanel);
		mainPanel.add(form,BorderLayout.CENTER);
		mainPanel.add(buttonsPanel,BorderLayout.SOUTH);
		pack();
		setVisible(true);
		buttonsPanel.addActionListner("Annuler",new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				dispose();
			}
		});
	}
}
